<template>
    <div>
        <div class="UnLogin" v-if="!AddressList.length">
            <p>登陆后使用常用地址</p>
            <p class="loginBtn" @click="login">登录</p>
        </div>
        <div v-if="AddressList.length">
            <ul>
                <li v-for="(item,index) of AddressList" :key="index">
                    <div>
                        <span>收货人:{{item.name}}</span>
                    </div>
                    <div>
                        <P class="tag"></P>
                        <p class="address"></p>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>
<script>
import getUserInfo from './getUserInfo';
import {mapGetters} from 'vuex';
let sessionId = '84b2baede0af43399258b1a9ab493f13';
export default {
    data () {
        return {
            AddressList: []
        }
    },
    components:{

    },
    computed:{
        
    },
    async mounted(){
        if(sessionId){
            let userInfo = await getUserInfo(api.customer_host,sessionId);
            this.AddressList = userInfo.data.data[0].addressLists;
            console.log(userInfo.data.data[0].addressLists,'userInfo');
        }
    },
    methods:{
        login() {
            postMessage("dsdsdsdssd");
        }
    },
    watch:{
        
    }
}
</script>
<style scoped>
.UnLogin{
    width:100%;
    height:2.4rem;
    box-sizing: border-box;
    padding: 0 3%;
    background:white;
    display: flex;
    font-size: .9rem;
    /* line-height: 2.2rem; */
    align-items: center;
    justify-content: space-between;
}
.loginBtn{
    width: 2.4rem;
    height: 1.4rem;
    line-height: 1.6rem;
    border-radius: .2rem;
    border: 1px solid #80B760;
    color: #80B760;
}
</style>